#pragma once

#include <iostream>
#include <string>

using namespace std;

// 假设有个 Messager 类
// 客户端调用这个类实现通信功能
class Messager {
public:
	Messager() {}
	virtual ~Messager() {}

	virtual void Login(string username, string password) = 0;
	virtual void SendMessage(string message) = 0;
	virtual void SendPictrue(string image_path) = 0;

	virtual void PlaySound() = 0;
	virtual void DrawShape() = 0;
	virtual void WirteText() = 0;
	virtual void Connect() = 0;
};

// 平台实现
class PCMessagerBase : public Messager {
public:
    virtual void Login(string username, string password)  {

    }
    virtual void SendMessage(string message)  {

    }
    virtual void SendPictrue(string image_path)  {

    }

    virtual void PlaySound() {

    }
    virtual void DrawShape() {

    }
    virtual void WirteText() {

    }
    virtual void Connect() {

    }
};

// 业务抽象
// 经典版
class PCMessagerLite : public PCMessagerBase {
public:
    virtual void Login(string username, string password) {
        PCMessagerBase::Connect();
    }
    virtual void SendMessage(string message) {
        PCMessagerBase::WirteText();
    }
    virtual void SendPictrue(string image_path) {
        PCMessagerBase::DrawShape();
    }
};

// 完整版
class PCMessagerFull : public PCMessagerBase {
public:
    virtual void Login(string username, string password) {
        PCMessagerBase::PlaySound();
        PCMessagerBase::Connect();
    }
    virtual void SendMessage(string message) {
        PCMessagerBase::PlaySound();
        PCMessagerBase::WirteText();
    }
    virtual void SendPictrue(string image_path) {
        PCMessagerBase::PlaySound();
        PCMessagerBase::DrawShape();
    }
};

// 移动端平台实现
class MoblicMessagerBase : public Messager {

};

// 业务抽象
class MoblieMessagerLite : public MoblicMessagerBase {
    virtual void Login(string username, string password) {
        MoblicMessagerBase::Connect();
    }
    virtual void SendMessage(string message) {
        MoblicMessagerBase::WirteText();
    }
    virtual void SendPictrue(string image_path) {
        MoblicMessagerBase::DrawShape();
    }
};

class MoblieMessagerFull : public MoblicMessagerBase {
    virtual void Login(string username, string password) {
        MoblicMessagerBase::PlaySound();
        MoblicMessagerBase::Connect();
    }
    virtual void SendMessage(string message) {
        MoblicMessagerBase::PlaySound();
        MoblicMessagerBase::WirteText();
    }
    virtual void SendPictrue(string image_path) {
        MoblicMessagerBase::PlaySound();
        MoblicMessagerBase::DrawShape();
    }
};

void Process() {
    PCMessagerBase *pc = new PCMessagerLite;
    delete pc;
    // MoblicMessagerBase *m = new MoblieMessagerFull;
    // delete m;
}
